package com.web;

import com.pojo.SUser;
import com.service.IShowUserService;
import com.service.impl.ShowUserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/user.do")
public class UsersServlet extends BaseServlet {

    private IShowUserService service = new ShowUserServiceImpl();

    protected void findPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String current = request.getParameter("current");
        List<SUser> users = service.users();
        request.getSession().setAttribute("users",users);
        request.getRequestDispatcher("/users.jsp").forward(request,response);
    }
}
